<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>求红白黑球的个数</title>
</head>

<body>
    <script>
        var red = 0,
            white = 0,
            black = 0;
        for (white = 0; white <= 25; white++) {
            red = 25 - white;
            black = 31 - white;
            if (red + black == 28) {
                alert('红球:' + red + '\n' + '白球:' + white + '\n' + '黑球:' + black)
            }
        }
    </script>
</body>

</html>